Skip to content

Conversation

@xbharani
Copy link

  • Checks for fscryptctl binary presence
  • Creates a random sw encryption key
  • Applies and verifies encryption policy
  • Confirms functionality with a test file

@github-actions
Copy link

This pull request has been marked as stale due to 30 days of inactivity. To prevent automatic closure in 7 days, remove the stale label or add a comment. You can reopen a closed pull request at any time.

@github-actions github-actions bot added the Stale label Sep 12, 2025
@smuppand
Copy link
Contributor

@xbharani Any update on the requested changes?

@github-actions github-actions bot removed the Stale label Sep 13, 2025
@github-actions
Copy link

This pull request has been marked as stale due to 30 days of inactivity. To prevent automatic closure in 7 days, remove the stale label or add a comment. You can reopen a closed pull request at any time.

@xbharani xbharani force-pushed the main branch 2 times, most recently from bd6eccf to 56d715d Compare November 20, 2025 09:52
@xbharani xbharani force-pushed the main branch 2 times, most recently from 686cf9f to 8f29437 Compare December 8, 2025 05:26
Copy link
Contributor

@smuppand smuppand left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

the script is close, but a few things will bite in CI / reliability, plus a couple of correctness/safety issues.

Copy link
Contributor

@smuppand smuppand left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

A few additional minor changes are required. Other than that, everything appears to be fine.

Copy link
Contributor

@smuppand smuppand left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Few nice to have changes

Copy link
Contributor

@smuppand smuppand left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Still few must fix items.

log_info "Created unique mount directory: $MOUNT_DIR"


FS_PATH=$(df --output=target "$MOUNT_DIR" | tail -n 1)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

if there's any chance of a busybox/ non-GNU environment, just be aware --output=target may not exist. Given the meta-qcom target, it's probably fine. If we want to be ultra-portable in future, this part might be abstracted into hlper, but for now it's acceptable.

Still it is not addressed. This is ok most of the time. But it can include leading spaces depending on the df output formatting.

safer
FS_PATH="$(df --output=target "$MOUNT_DIR" 2>/dev/null | awk 'NR==2{print $1}')"

- Checks for fscryptctl binary presence
- Creates a random sw encryption key
- Applies and verifies encryption policy
- Confirms functionality with a test file
- Added yaml config

Signed-off-by: Bharani Bhuvanagiri <bbharani@qti.qualcomm.com>
if ! "$FSCRYPTCTL" remove_key "$key_id" "$FS_PATH" >/dev/null 2>&1; then
log_warn "Failed to remove key $key_id from $FS_PATH"
else
log_warn "removed key $key_id from $FS_PATH"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

log_info have to be used.


add_key_output=$("$FSCRYPTCTL" add_key "$FS_PATH" < "$KEY_FILE" 2>&1)
rc=$?
key_id=$(printf '%s\n' "$add_key_output" | head -n1)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Make key_id parsing robust.

key_id=$(printf '%s\n' "$add_key_output" | awk 'match($0,/^[0-9a-fA-F]{32}$/){print $0; exit}')

FS_PATH=$(df --output=target -- "$MOUNT_DIR" 2>/dev/null | awk 'NR==2{print $1}')

if [ -z "${FS_PATH:-}" ]; then
FS_PATH=$(df -- "$MOUNT_DIR" 2>/dev/null | awk 'NR==2{print $NF}')
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

use posix-ish df fallback

FS_PATH=$(df -P "$MOUNT_DIR" 2>/dev/null | awk 'NR==2{print $6}')

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants